cc.Class({
    extends: cc.Component,

    properties: {
        speed: 0,
        top: 150,
        space: 100,
        downPencil: cc.Node,
        upPencil: cc.Node
    },

    onEnable() {
        let setTop = cc.randomMinus1To1() * this.top;
        this.upPencil.y = setTop + this.space;
        this.downPencil.y = setTop;
    },

    start () {

    },
    update (dt) {
        if (!D.game.run) {
            return;
        }
        this.node.x -= this.speed;
        const disapper = this.node.getBoundingBoxToWorld().xMax < 0;
        if (disapper) {
            D.pencilsManger.despawnPencils(this.node);
        }
    },
});
